cmake_minimum_required(VERSION 3.8)
message(STATUS "cmake version ${CMAKE_VERSION}")

set(TOOLCHAIN_DIR /opt/atk-dlrv1126-toolchain)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/usr/bin/arm-linux-gnueabihf-g++)
set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/usr/bin/arm-linux-gnueabihf-gcc)

set(SYSROOT /home/jack/rv1126doc/toolchainn1.8/include)

set(CMAKE_CXX_STANDARD 11)
add_definitions(-g -O0 -ggdb -gdwarf -funwind-tables -rdynamic)
add_definitions(-Wno-write-strings -Wno-return-type)

#set(OPENCV_LIBS opencv_core opencv_imgcodecs opencv_imgproc opencv_features2d opencv_flann opencv_highgui opencv_freetype)
set(RKMEDIA_LIBS easymedia rga rkaiq rockx asound drm rockchip_mpp v4l2 v4lconvert RKAP_ANR RKAP_Common RKAP_3A md_share od_share)
set(FFMPEG_LIBS avformat avcodec swresample avutil x264)

#aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} RKMEDIA_CPP)
file(GLOB RKMEDIA_CPP ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
#message(STATUS ${RKMEDIA_CPP})

include_directories(${SYSROOT})
include_directories(${SYSROOT}/easymedia)
include_directories(${SYSROOT}/rkmedia)
include_directories(${SYSROOT}/ffmpeg4.2.2)
include_directories(${SYSROOT}/rga)
include_directories(${SYSROOT}/rkaiq/uAPI)
include_directories(${SYSROOT}/rkaiq/xcore)
include_directories(${SYSROOT}/rkaiq/algos)
include_directories(${SYSROOT}/rkaiq/common)
include_directories(${SYSROOT}/rkaiq/iq_parser)
include_directories(${SYSROOT}/rockx)
include_directories(.)

link_directories(${SYSROOT}/../lib)
add_link_options("LINKER:-rpath-link,${SYSROOT}/../lib")

add_definitions(-DRKAIQ)

project(rkmedia_ffmpeg_main)
add_executable(rkmedia_ffmpeg_main ${RKMEDIA_CPP})
target_link_libraries(rkmedia_ffmpeg_main ${RKMEDIA_LIBS} ${FFMPEG_LIBS} pthread dl)